Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use BB code hash for vk caching #7396

Merged
merged 8 commits into from
Jul 9, 2024
Merged

Conversation

sirasistant
Copy link
Contributor

Please read contributing guidelines and remove this line.

@sirasistant sirasistant changed the title dummy change to test vk caching feat: Use BB code hash for vk caching Jul 9, 2024
@sirasistant sirasistant marked this pull request as ready for review July 9, 2024 16:12
@sirasistant sirasistant requested a review from ludamad July 9, 2024 16:12
@sirasistant sirasistant enabled auto-merge (squash) July 9, 2024 16:13
@@ -26,10 +26,12 @@ build-contracts:
SAVE ARTIFACT noir-contracts

build-protocol-circuits:
LOCALLY
LET bb_source_hash = $(cd .. && git ls-tree -r HEAD | grep 'barretenberg/cpp' | awk '{print $3}' | git hash-object --stdin)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very clever line /s

@sirasistant sirasistant merged commit b03f1a2 into master Jul 9, 2024
89 checks passed
@sirasistant sirasistant deleted the arv/test_vk_caching branch July 9, 2024 16:31
@AztecBot
Copy link
Collaborator

AztecBot commented Jul 9, 2024

Benchmark results

Metrics with a significant change:

  • avm_simulation_time_ms (Token:assert_minter_and_mint): 92.9 (+42%)
  • avm_simulation_time_ms (Token:_increase_public_balance): 94.9 (+534%)
  • app_circuit_proving_time_in_ms (AuthRegistry:set_authorized (avm)): 1,606 (+16%)
  • app_circuit_proving_time_in_ms (FPC:pay_refund (avm)): 17,954 (-23%)
  • protocol_circuit_witness_generation_time_in_ms (public-kernel-tail): 22,310 (-16%)
  • protocol_circuit_proving_time_in_ms (private-kernel-init): 18,190 (+22%)
  • protocol_circuit_proving_time_in_ms (base-rollup): 78,465 (-16%)
  • protocol_circuit_proving_time_in_ms (public-kernel-setup): 36,465 (-17%)
  • protocol_circuit_proving_time_in_ms (public-kernel-app-logic): 37,165 (-18%)
  • protocol_circuit_proving_time_in_ms (public-kernel-tail): 158,062 (-18%)
  • protocol_circuit_proving_time_in_ms (root-rollup): 19,478 (-19%)
Detailed results

All benchmarks are run on txs on the Benchmarking contract on the repository. Each tx consists of a batch call to create_note and increment_balance, which guarantees that each tx has a private call, a nested private call, a public call, and a nested public call, as well as an emitted private note, an unencrypted log, and public storage read and write.

This benchmark source data is available in JSON format on S3 here.

Proof generation

Each column represents the number of threads used in proof generation.

Metric 1 threads 4 threads 16 threads 32 threads 64 threads
proof_construction_time_sha256_ms 5,785 (+1%) 1,564 (+2%) 736 (+5%) 773 (+4%) 786 (+2%)
proof_construction_time_sha256_30_ms 12,406 (+6%) 3,315 (+6%) 1,544 (+10%) 1,522 (+7%) 1,536 (+5%)
proof_construction_time_sha256_100_ms 45,562 (+4%) 12,696 (+8%) 6,240 (-6%) 6,069 (+13%) 5,938 (+11%)
proof_construction_time_poseidon_hash_ms 78.0 34.0 34.0 58.0 (-2%) 87.0
proof_construction_time_poseidon_hash_30_ms 1,519 416 203 (+2%) 219 (-4%) 268 (+1%)
proof_construction_time_poseidon_hash_100_ms 5,695 (+1%) 1,544 (+2%) 713 (+5%) 744 (+4%) 768 (+3%)

L2 block published to L1

Each column represents the number of txs on an L2 block published to L1.

Metric 4 txs 8 txs 16 txs
l1_rollup_calldata_size_in_bytes 1,412 1,412 1,412
l1_rollup_calldata_gas 9,476 9,464 9,464
l1_rollup_execution_gas 613,504 613,643 613,794
l2_block_processing_time_in_ms 768 (+2%) 1,422 2,718
l2_block_building_time_in_ms 12,870 (-1%) 25,476 (-1%) 49,780 (-1%)
l2_block_rollup_simulation_time_in_ms 12,869 (-1%) 25,476 (-1%) 49,780 (-1%)
l2_block_public_tx_process_time_in_ms 10,826 (-1%) 23,254 (-1%) 47,553 (-1%)

L2 chain processing

Each column represents the number of blocks on the L2 chain where each block has 8 txs.

Metric 3 blocks 5 blocks
node_history_sync_time_in_ms 7,100 (+1%) 10,149 (+2%)
node_database_size_in_bytes 12,480,592 16,179,280
pxe_database_size_in_bytes 16,254 26,813

Circuits stats

Stats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.

Circuit simulation_time_in_ms witness_generation_time_in_ms proving_time_in_ms input_size_in_bytes output_size_in_bytes proof_size_in_bytes num_public_inputs size_in_gates
private-kernel-init 108 (-2%) 411 (+2%) ⚠️ 18,190 (+22%) 20,002 55,022 74,208 2,252 524,288
private-kernel-inner 222 734 (+4%) 26,562 (-10%) 82,134 55,022 74,208 2,252 1,048,576
private-kernel-tail 1,050 (-1%) 2,526 (+4%) 49,754 (-10%) 62,409 62,089 14,944 400 2,097,152
base-parity 6.35 (+1%) 936 (+11%) 2,433 (-7%) 160 96.0 2,240 3.00 131,072
root-parity 70.7 (+2%) 63.4 (-13%) 34,036 (-15%) 27,868 96.0 2,752 19.0 2,097,152
base-rollup 4,121 (-1%) 5,014 (+3%) ⚠️ 78,465 (-16%) 172,028 632 3,552 44.0 4,194,304
root-rollup 129 (+2%) 75.5 (-12%) ⚠️ 19,478 (-19%) 25,053 652 3,488 42.0 1,048,576
public-kernel-setup 188 (-1%) 2,337 (-2%) ⚠️ 36,465 (-17%) 103,911 80,310 106,944 3,275 2,097,152
public-kernel-app-logic 144 (-1%) 3,281 ⚠️ 37,165 (-18%) 103,911 80,310 106,944 3,275 2,097,152
public-kernel-tail 891 ⚠️ 22,310 (-16%) ⚠️ 158,062 (-18%) 400,808 10,046 14,944 400 8,388,608
private-kernel-reset-small 291 (-1%) 1,350 (+2%) 24,592 (-11%) 79,273 55,022 74,208 2,252 1,048,576
public-kernel-teardown 134 3,288 (-1%) 36,471 (-15%) 103,911 80,310 106,944 3,275 2,097,152
merge-rollup 40.3 N/A N/A 16,094 632 N/A N/A N/A
private-kernel-tail-to-public N/A 9,116 (+4%) 54,000 (-10%) N/A N/A 106,944 3,275 2,097,152

Stats on running time collected for app circuits

Function input_size_in_bytes output_size_in_bytes witness_generation_time_in_ms proof_size_in_bytes proving_time_in_ms size_in_gates num_public_inputs
ContractClassRegisterer:register 1,312 9,344 402 (+2%) N/A N/A N/A N/A
ContractInstanceDeployer:deploy 1,376 9,344 25.1 (+2%) N/A N/A N/A N/A
MultiCallEntrypoint:entrypoint 1,888 9,344 657 (+2%) N/A N/A N/A N/A
GasToken:deploy 1,344 9,344 560 N/A N/A N/A N/A
SchnorrAccount:constructor 1,280 9,344 487 (+2%) N/A N/A N/A N/A
SchnorrAccount:entrypoint 2,272 9,344 829 (+1%) 15,840 5,071 131,072 428
Token:privately_mint_private_note 1,248 9,344 567 (+6%) N/A N/A N/A N/A
FPC:fee_entrypoint_public 1,312 9,344 107 (+6%) 15,840 1,911 (+11%) 65,536 428
Token:transfer 1,280 9,344 1,653 (+2%) 15,840 9,872 (-14%) 524,288 428
AuthRegistry:set_authorized (avm) 19,222 N/A N/A 91,232 ⚠️ 1,606 (+16%) N/A N/A
FPC:prepare_fee (avm) 26,664 N/A N/A 91,296 2,847 (-5%) N/A N/A
Token:transfer_public (avm) 42,914 N/A N/A 91,296 3,708 (-3%) N/A N/A
AuthRegistry:consume (avm) 33,100 N/A N/A 91,232 2,918 (+2%) N/A N/A
FPC:pay_refund (avm) 36,829 N/A N/A 91,264 ⚠️ 17,954 (-23%) N/A N/A
Benchmarking:create_note 1,312 9,344 473 (+1%) N/A N/A N/A N/A
SchnorrAccount:verify_private_authwit 1,248 9,344 43.4 (+5%) N/A N/A N/A N/A
Token:unshield 1,344 9,344 1,358 (+2%) N/A N/A N/A N/A
FPC:fee_entrypoint_private 1,344 9,344 1,763 (+2%) N/A N/A N/A N/A

AVM Simulation

Time to simulate various public functions in the AVM.

Function time_ms bytecode_size_in_bytes
GasToken:_increase_public_balance 79.4 (+1%) 13,790
GasToken:set_portal 13.7 (-6%) 3,339
Token:constructor 102 (+1%) 23,692
FPC:constructor 75.0 (+6%) 13,592
GasToken:mint_public 62.8 (+3%) 10,158
Token:mint_public 53.6 (-16%) 19,034
Token:assert_minter_and_mint ⚠️ 92.9 (+42%) 12,925
AuthRegistry:set_authorized 32.9 (-1%) 7,812
FPC:prepare_fee 103 (+5%) 15,062
Token:transfer_public 35.8 (-13%) 31,218
FPC:pay_refund 130 (+1%) 25,260
Benchmarking:increment_balance 1,315 (-1%) 15,267
Token:_increase_public_balance ⚠️ 94.9 (+534%) 15,006
FPC:pay_refund_with_shielded_rebate 169 (+4%) 26,347

Public DB Access

Time to access various public DBs.

Function time_ms
get-nullifier-index 0.153

Tree insertion stats

The duration to insert a fixed batch of leaves into each tree type.

Metric 1 leaves 16 leaves 64 leaves 128 leaves 256 leaves 512 leaves 1024 leaves
batch_insert_into_append_only_tree_16_depth_ms 10.4 (+1%) 16.8 (+1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_count 16.8 31.7 N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_16_depth_hash_ms 0.604 (+1%) 0.516 (+1%) N/A N/A N/A N/A N/A
batch_insert_into_append_only_tree_32_depth_ms N/A N/A 48.4 (+1%) 76.1 (+1%) 131 245 472 (+1%)
batch_insert_into_append_only_tree_32_depth_hash_count N/A N/A 95.9 159 287 543 1,055
batch_insert_into_append_only_tree_32_depth_hash_ms N/A N/A 0.495 (+1%) 0.468 0.452 (+1%) 0.445 0.440 (+1%)
batch_insert_into_indexed_tree_20_depth_ms N/A N/A 60.0 (+1%) 112 (+1%) 183 (+1%) 353 (-1%) 694 (+1%)
batch_insert_into_indexed_tree_20_depth_hash_count N/A N/A 109 207 355 691 1,363
batch_insert_into_indexed_tree_20_depth_hash_ms N/A N/A 0.507 (+1%) 0.501 0.485 (+1%) 0.478 0.476
batch_insert_into_indexed_tree_40_depth_ms N/A N/A 73.1 (+1%) N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_count N/A N/A 133 N/A N/A N/A N/A
batch_insert_into_indexed_tree_40_depth_hash_ms N/A N/A 0.520 (+1%) N/A N/A N/A N/A

Miscellaneous

Transaction sizes based on how many contract classes are registered in the tx.

Metric 0 registered classes 1 registered classes
tx_size_in_bytes 74,082 667,868

Transaction size based on fee payment method

| Metric | |
| - | |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants